<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>运算符</title>
</head>
<body>
<script>
    var a = true;
    a = +a;
    console.log('a：' + a);
    console.log(typeof a);

    console.log('-----------------');

    var b = '18';
    b = +b;
    console.log('b：' + b);
    console.log(typeof b);

    //自减
    var n1=10;
    var n2=20;

    var n = n1++; //n1 = 11  n1++ = 10

    console.log('n='+n);  // 10
    console.log('n1='+n1); //11

    n = ++n1 //n1 = 12  ++n1 =12
    console.log('n='+n); //12
    console.log('n1='+n1); //12

    n = n2--;// n2=19 n2--=20
    console.log('n='+n); //20
    console.log('n2='+n2); //19

    n = --n2; //n2=18 --n2 = 18
    console.log('n='+n); //18
    console.log('n2='+n2); //18

    //非数值比较
    console.log(1 > true); //false
    console.log(1 >= true); //true
    console.log(1 > "0"); //true
    console.log(10 <= "hello"); //false
    console.log(true > false); //true

    // //"=="强调
    // console.log("6" == 6);		// 这里的字符串"6"会先转换为数字6，然后再进行比较
    // console.log(true == "1");
    // console.log(0 == -0);
    //
    // console.log(null == 0);

    //!=
    console.log(3 != 8);
    console.log(3 != "3");
    console.log(3 !== "3");
</script>
</body>
</html>